/*
 * @Author: 灰灰
 * @Date: 2021-12-24 15:09:47
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-12-27 11:43:50
 */

import store from '@/store';

// 功能权限码  是否有这功能
export function permiss(el, binding) {
  const codeList = store.getters.permCodes || [];
  console.log("🚀 ~ file: index.js ~ line 13 ~ permiss ~ codeList", codeList)
  let value = binding.value;
  if (Object.prototype.toString.call(binding.value).indexOf('Object') !== -1) {
    if (!binding.value.show) {
      // 删除操作按钮
      el && el.parentNode && (el.parentNode.removeChild(el))
    } else {
      value = binding.value.permiss;
    }
  }
  if (!codeList.includes(value)) {
    // 没有使用权限  删除操作按钮
    el && el.parentNode && (el.parentNode.removeChild(el))
  }
}

// 角色 是否有这角色
// const hasRole = {
//   inserted: function (el, binding) {

//   }
// }

// export {
//   hasRole
// };